//
//  LoginViewController.m
//  PhotographyStudi
//
//  Created by 叶一枫 on 2017/5/16.
//  Copyright © 2017年 叶一枫. All rights reserved.
//

#import "LoginViewController.h"

@interface LoginViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UITextField *userAccont;
@property (weak, nonatomic) IBOutlet UITextField *userPassWord;

@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
}


- (IBAction)userLoginClick:(UIButton *)sender {
    
    
}



- (IBAction)otherLogin:(UIButton *)sender {
    
    switch (sender.tag) {
        case 0:
            [self getUserInfoForPlatform:1];
            break;
        case 1:
            [self getUserInfoForPlatform:4];
            break;
        case 2:
            [self getUserInfoForPlatform:0];
            break;
        case 3:
            [self getUserInfoForPlatform:7];
            break;
        default:
            break;
    }
}

- (void)getUserInfoForPlatform:(UMSocialPlatformType)platformType{
    
    [[BSTool sharedBSTool]goRootVCFromtype:@"HOME"];
    
    [[UMSocialManager defaultManager] getUserInfoWithPlatform:platformType currentViewController:self completion:^(id result, NSError *error) {
        if ([result isKindOfClass:[NSDictionary class]]) {
            UMSocialUserInfoResponse *resp = result;
            // 第三方平台SDK原始数据
            NSLog(@" originalResponse: %@", resp.originalResponse);
            
            User *user = [[User alloc]init];
            user.uid = resp.uid;
            user.uname = resp.name;
            user.userAvatar = resp.iconurl;
            user.accessToken = resp.accessToken;
            
        }else{
            
            
        }
    }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
